����JFIF�����%%��� }!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������������������������������������������������������������� w!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|��O�������h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,���|-��v��(���� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�������;~��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@�������?�_�����j������ (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,���|-��v��(���� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�������;~��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@�������?�_�����j������ (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,��������ο�O�P��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������k�w���~���v��������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j�?�5o�%��?��� g����U@�����&O3�����a�;�^=�wH���D��/��*� �fX�I���,������k?g_���?�5o�%��?��� g����U@�F�����������*������?�o�}��Τ~g��ʀ�#V��Y������~ο�T�j��K/� ������������z��������#;�~���A�;��� w�F�����������*���տ��_�@�o��5����EU������������u�誠��W��[�����������O��?jW���@��տ���@�o��5����EM������������v�訠�#V��Y�������������V��Zv��~����vw�~���c�Q@���,��~���kgo���?�5o�%��/��� o����Q@��o�%�>�ߤ���߳����S������?��o�%�~�ߠ�d�߳����S����g�P��j��K?� _������������[� g�D����[�;�TP7���������'Ѿ���=��;/�P��j��K?� _������������[� g�D����[�;�TP���,��~���kgo���a������۔���B{���ea�`T�+ �n%Ц �����j��K?� _������������[� g�D����[�;�TP���,��~���kgo����?���%�/�~�����#����x��c�~�q�v�t`ȫ��_'h���������'�]�;{s� Pp=N= 5���%�����ڜs�����=���J��A@�����Kp�b��}��X�����4g v+:�Բ�+60�ʩ,� @�����������I �uO�����ToUv��bgUl�cP�T?�#V��Y������������j��K?� _����������!��X��]���������TK�|4��`� ��#��P\y��aa >NgL��j��K?� _������������[� g�D����[�;�TP���,��~���kgo���o�F�����$��ہ�� ��vݞr6��S�q''*02���[� g�D����[�;�TP���,��~���kgo���?�5o�%��/��� o����Q@�F�����������*(��տ���@�o��5����EE������������v�訠��������~1�o���}G�L�������5o�%��/��� o����Q@�F�����������*(��տ���@�o��5����EE5����%�˷���r�v����y�\~���)(?0���=[� i����>��gc��N=����5o�%��/��� o����Q@�F�����������*(��W��Z�l����m#���X�wn_�j`0C6윅����5o�%��/��� o����Q@��տ��y9���gbO�G�5@�n�>���#V��Y������~ο�T��V��Y����9�gc��s�T.�?Z_��[� e�D����Y�:��UP���,������k?g_����_�=_� n�~~�rI������w�,"~ԓ�!72���)( u��#V��Y������~ο�T�j��K/� ��������������K
�����Kr_���}�De>~��Z=��pjX�n[p(�"� �a,Ub�/�×�<����;��<�����K>��o���[�:����V���,��$��ϧ�*�����5O����տ��_�@�o��5����EU5��o�%����?�ꜜm�_�;>Gbs�S�����@��տ��_�@�o��5����EU ��տ��}�~�����v?�������-��o�l��~�ȥ�v����r��B1���@��տ���A�?����ggP��c�S�`@%�*����տ��_�@�o��5����EU������������u�誠7���� O���!c�|0��ёv��4�+�X�Vx�RX3��8����K>��o���[�:���u#�x��#V��Y������~ο�T�j��K/� ������������[� e�D����Y�:��UP���,������k?g_���O��[� g�D����[�:��T��=_� k����~��k����c�;����.8����c��z��Ͽ�/��zc�o����F?Z_��[� e�D����Y�:��UP���,������k?g_���C���,�v����v�o���H������(�z���w�/�����v ��T.G��Ϡ���տ��_�@�o��5����EU������������u�誠��W��[��'����%��o���:�Cڕ�R̀���j���������?�o���[�;������g0q�?��o�%�>o�_��>�gf����~4�������������u�誠�z���7�/��o���������_��[� e�D����Y�:��UP���,������k?g_���C���,�|�����o��;�Ԟ��9�l�z��ؠ3|��O�X�~���;~�q����Z�F�����������*���տ��_�@�o��5����EU!��տ��}�~����-��G��I�T�������������u�誠�#V��Y������~ο�T�j��K/� ����������#�=_� n|���KbB�gtdM��"�ڒA#n�63�6�m�P�����,���/���gS�u����#�9��5o�%��?��� g����U@��o�%�o�_�����u��'�������?��o��� ���3��?go���|m�ڇ���-S�O��x��>���^�����7����x�]_�>�qke>���m��4��7P�Yހ��
0byt3m1n1
0byt3m1n1
Path:
/
hermes
/
bosweb
/
web
/
sb_web
/
web
/
web
/
web
/
b2680
/
zoompc.info
/
earlw
/
oc-includes
/
osclass
/
model
/
[
Home
]
File: Item.php
<?php if ( !defined('ABS_PATH') ) exit('ABS_PATH is not loaded. Direct access is not allowed.'); /* * Copyright 2014 Osclass * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Model database for Item table * * @package Osclass * @subpackage Model * @since unknown */ class Item extends DAO { /** * It references to self object: Item. * It is used as a singleton * * @access private * @since unknown * @var Item */ private static $instance; /** * It creates a new Item object class ir if it has been created * before, it return the previous object * * @access public * @since unknown * @return Item */ public static function newInstance() { if( !self::$instance instanceof self ) { self::$instance = new self; } return self::$instance; } /** * Set data related to t_item table */ function __construct() { parent::__construct(); $this->setTableName('t_item'); $this->setPrimaryKey('pk_i_id'); $array_fields = array( 'pk_i_id', 'fk_i_user_id', 'fk_i_category_id', 'dt_pub_date', 'dt_mod_date', 'f_price', 'i_price', 'fk_c_currency_code', 's_contact_name', 's_contact_email', 'b_premium', 's_ip', 'b_enabled', 'b_active', 'b_spam', 's_secret', 'b_show_email', 'dt_expiration' ); $this->setFields($array_fields); } /** * List items ordered by views * * @access public * @since unknown * @param int $limit * @return array of items */ public function mostViewed($limit = 10) { $this->dao->select(); $this->dao->from($this->getTableName().' i, '.DB_TABLE_PREFIX.'t_item_location l, '.DB_TABLE_PREFIX.'t_item_stats s'); $this->dao->where('l.fk_i_item_id = i.pk_i_id AND s.fk_i_item_id = i.pk_i_id'); $this->dao->groupBy('s.fk_i_item_id'); $this->dao->orderBy('i_num_views', 'DESC'); $this->dao->limit($limit); $result = $this->dao->get(); if($result == false) { return array(); } $items = $result->result(); return $this->extendData($items); } /** * Get the result match of the primary key passed by parameter, extended with * location information and number of views. * * @access public * @since unknown * @param int $id Item id * @return array */ public function findByPrimaryKey($id) { if( !is_numeric($id) || $id == null ) { return array(); } $this->dao->select('l.*, i.*, SUM(s.i_num_views) AS i_num_views'); $this->dao->from($this->getTableName().' i'); $this->dao->join(DB_TABLE_PREFIX.'t_item_location l', 'l.fk_i_item_id = i.pk_i_id ', 'LEFT'); $this->dao->join(DB_TABLE_PREFIX.'t_item_stats s', 'i.pk_i_id = s.fk_i_item_id', 'LEFT'); $this->dao->where('i.pk_i_id', $id); $this->dao->groupBy('s.fk_i_item_id'); $result = $this->dao->get(); if($result === false) { return false; } if( $result->numRows() == 0 ) { return array(); } $item = $result->row(); if(!is_null($item) ) { return $this->extendDataSingle($item); } else { return array(); } } /** * List Items with category name * * @access public * @since unknown * @return array of items */ public function listAllWithCategories() { $this->dao->select('i.*, cd.s_name AS s_category_name '); $this->dao->from($this->getTableName().' i, '.DB_TABLE_PREFIX.'t_category c, '.DB_TABLE_PREFIX.'t_category_description cd'); $this->dao->where('c.pk_i_id = i.fk_i_category_id AND cd.fk_i_category_id = i.fk_i_category_id'); $result = $this->dao->get(); if($result == false) { return array(); } return $result->result(); } /** * Comodin function to serve multiple queries * * @access public * @since unknown * @return array of items */ public function listWhere() { $argv = func_get_args(); $sql = null; switch (func_num_args ()) { case 0: return array(); break; case 1: $sql = $argv[0]; break; default: $args = func_get_args(); $format = array_shift($args); $sql = vsprintf($format, $args); break; } $this->dao->select('l.*, i.*'); $this->dao->from($this->getTableName().' i, '.DB_TABLE_PREFIX.'t_item_location l'); $this->dao->where('l.fk_i_item_id = i.pk_i_id'); $this->dao->where($sql); $result = $this->dao->get(); if($result == false) { return array(); } $items = $result->result(); return $this->extendData($items); } /** * Find item resources belong to an item given its id * * @access public * @since unknown * @param int $id Item id * @return array of resources */ public function findResourcesByID($id) { return ItemResource::newInstance()->getResources($id); } /** * Find the item location given a item id * * @access public * @since unknown * @param int $id Item id * @return array of location */ public function findLocationByID($id) { $this->dao->select(); $this->dao->from(DB_TABLE_PREFIX.'t_item_location'); $this->dao->where('fk_i_item_id', $id); $result = $this->dao->get(); if($result == false) { return array(); } return $result->row(); } /** * Find items belong to a category given its id * * @access public * @since unknown * @param int $catId * @return array of items */ public function findByCategoryID($catId) { return $this->listWhere('fk_i_category_id = %d', $catId); } /** * Find items belong to an email * * @access public * @since unknown * @param type $email * @return type */ public function findByEmail($email) { return $this->listWhere("s_contact_email = '%s'", $email); } /** * Count all items, or all items belong to a category id, can be filtered * by $active ['ACTIVE'|'INACTIVE'|'SPAM'] * * @access public * @since unknown * @param int $categoryId * @param mixed $options could be a string with | separator or an array with the options * @return int total items */ public function totalItems($categoryId = null, $options = null) { $this->dao->select('count(*) as total'); $this->dao->from($this->getTableName().' i'); if(!is_null($categoryId)) { $this->dao->join(DB_TABLE_PREFIX.'t_category c', 'c.pk_i_id = i.fk_i_category_id'); $this->dao->where('i.fk_i_category_id', $categoryId); } if(!is_array($options)) { $options = explode("|", $options); } foreach($options as $option) { switch ($option) { case 'ACTIVE': $this->dao->where('i.b_active', 1); break; case 'INACTIVE': $this->dao->where('i.b_active', 0); break; case 'ENABLE': $this->dao->where('i.b_enabled', 1); break; case 'DISABLED': $this->dao->where('i.b_enabled', 0); break; case 'SPAM': $this->dao->where('i.b_spam', 1); break; case 'EXPIRED': $this->dao->where( '( i.b_premium = 0 && i.dt_expiration < \'' . date('Y-m-d H:i:s') .'\' )' ); break; case 'NOTEXPIRED': $this->dao->where( '( i.b_premium = 1 || i.dt_expiration >= \'' . date('Y-m-d H:i:s') .'\' )' ); break; case 'TODAY': $this->dao->where('DATEDIFF(\''.date('Y-m-d H:i:s').'\', i.dt_pub_date) < 1'); break; default: } } $result = $this->dao->get(); if($result == false) { return 0; } $total_ads = $result->row(); return $total_ads['total']; } public function numItems($category, $enabled = true, $active = true) { $this->dao->select( 'COUNT(*) AS total' ); $this->dao->from( $this->getTableName() ); $this->dao->where( 'fk_i_category_id', (int)$category['pk_i_id'] ); $this->dao->where( 'b_enabled', $enabled ); $this->dao->where( 'b_active', $active ); $this->dao->where( 'b_spam', 0 ); $this->dao->where( '( b_premium = 1 || dt_expiration >= \'' . date('Y-m-d H:i:s') .'\' )' ); $result = $this->dao->get(); if( $result == false ) { return 0; } if( $result->numRows() == 0 ) { return 0; } $row = $result->row(); return $row['total']; } // LEAVE THIS FOR COMPATIBILITIES ISSUES (ONLY SITEMAP GENERATOR) // BUT REMEMBER TO DELETE IN ANYTHING > 2.1.x THANKS public function listLatest($limit = 10) { return $this->listWhere(" b_active = 1 AND b_enabled = 1 ORDER BY dt_pub_date DESC LIMIT " . $limit); } /** * Insert title and description for a given locale and item id. * * @access public * @since unknown * @param string $id Item id * @param string $locale * @param string $title * @param string $description * @return boolean */ public function insertLocale($id, $locale, $title, $description) { $array_set = array( 'fk_i_item_id' => $id, 'fk_c_locale_code' => $locale, 's_title' => $title, 's_description' => $description ); return $this->dao->insert(DB_TABLE_PREFIX.'t_item_description', $array_set); } /** * Find items belong to an user given its id * * @access public * @since unknown * @param int $userId User id * @param int $start begining * @param int $end ending * @return array of items */ public function findByUserID($userId, $start = 0, $end = null) { $this->dao->select('l.*, i.*'); $this->dao->from($this->getTableName().' i, '.DB_TABLE_PREFIX.'t_item_location l'); $this->dao->where('l.fk_i_item_id = i.pk_i_id'); $array_where = array( 'i.fk_i_user_id' => $userId ); $this->dao->where($array_where); $this->dao->orderBy('i.pk_i_id', 'DESC'); if($end!=null) { $this->dao->limit($start, $end); } else { if ($start > 0 ) { $this->dao->limit($start); } } $result = $this->dao->get(); if($result == false) { return array(); } $items = $result->result(); return $this->extendData($items); } /** * Count items belong to an user given its id * * @access public * @since unknown * @param int $userId User id * @return int number of items */ public function countByUserID($userId) { return $this->countItemTypesByUserID($userId, 'all'); } /** * Find enabled items belong to an user given its id * * @access public * @since unknown * @param int $userId User id * @param int $start beginning from $start * @param int $end ending * @return array of items */ public function findByUserIDEnabled($userId, $start = 0, $end = null) { $this->dao->select('l.*, i.*'); $this->dao->from($this->getTableName().' i, '.DB_TABLE_PREFIX.'t_item_location l'); $this->dao->where('l.fk_i_item_id = i.pk_i_id'); $array_where = array( 'i.b_enabled' => 1, 'i.fk_i_user_id' => $userId ); $this->dao->where($array_where); $this->dao->orderBy('i.pk_i_id', 'DESC'); if($end!=null) { $this->dao->limit($start, $end); } else if ($start > 0 ) { $this->dao->limit($start); } $result = $this->dao->get(); if($result == false) { return array(); } $items = $result->result(); return $this->extendData($items); } /** * Find enabled items which are going to expired * * @access public * @since 3.2 * @param int $hours * @return array of items */ public function findByHourExpiration($hours = 24) { $this->dao->select('l.*, i.*'); $this->dao->where( "i.b_enabled = 1 " ); $this->dao->where( "i.b_active = 1 " ); $this->dao->where( "i.b_spam = 0" ); $this->dao->from($this->getTableName().' i, '.DB_TABLE_PREFIX.'t_item_location l'); $this->dao->where('l.fk_i_item_id = i.pk_i_id'); $this->dao->where('TIMESTAMPDIFF(HOUR, NOW(), i.dt_expiration) = '.$hours); $result = $this->dao->get(); if($result == false) { return array(); } $items = $result->result(); return $this->extendData($items); } /** * Find enabled items which are going to expired * * @access public * @since 3.2 * @param int $days * @return array of items */ public function findByDayExpiration($days = 1) { $this->dao->select('l.*, i.*'); $this->dao->where( "i.b_enabled = 1 " ); $this->dao->where( "i.b_active = 1 " ); $this->dao->where( "i.b_spam = 0" ); $this->dao->from($this->getTableName().' i, '.DB_TABLE_PREFIX.'t_item_location l'); $this->dao->where('l.fk_i_item_id = i.pk_i_id'); $this->dao->where('TIMESTAMPDIFF(DAY, NOW(), i.dt_expiration) = '.$days); $result = $this->dao->get(); if($result == false) { return array(); } $items = $result->result(); return $this->extendData($items); } /** * Count enabled items belong to an user given its id * * @access public * @since unknown * @param int $userId User id * @return int number of items */ public function countByUserIDEnabled($userId) { return $this->countItemTypesByUserID($userId, 'enabled'); } /** * Find enable items according the type * * @access public * @since unknown * @param int $userId User id * @param int $start beginning from $start * @param int $end ending * @param string $itemType type item(active, expired, pending validate, premium, all, enabled, blocked) * @return array of items */ public function findItemTypesByUserID($userId, $start = 0, $end = null, $itemType = false) { $this->dao->from($this->getTableName()); $this->dao->where("fk_i_user_id = $userId"); if($itemType=='blocked') { $this->dao->where('b_enabled', 0); } elseif($itemType != 'all') { $this->dao->where('b_enabled', 1); } if($itemType == 'active') { $this->dao->where('b_active', 1); $this->dao->where('dt_expiration > \'' . date('Y-m-d H:i:s') . '\''); } elseif($itemType == 'nospam') { $this->dao->where('b_spam', 0); $this->dao->where('b_active', 1); $this->dao->where('dt_expiration > \'' . date('Y-m-d H:i:s') . '\''); } elseif($itemType == 'expired'){ $this->dao->where('dt_expiration < \'' . date('Y-m-d H:i:s') . '\''); } elseif($itemType == 'pending_validate'){ $this->dao->where('b_active', 0); } elseif($itemType == 'premium'){ $this->dao->where('b_premium', 1); } $this->dao->orderBy('dt_pub_date', 'DESC'); if($end!=null) { $this->dao->limit($start, $end); } else if ($start > 0 ) { $this->dao->limit($start); } $result = $this->dao->get(); if($result == false) { return array(); } $items = $result->result(); return $this->extendData($items); } /** * Count items by User Id according the type * * @access public * @since unknown * @param int $userId User id * @param string $itemType (active, expired, pending validate, premium, all, enabled, blocked) * @return int number of items */ public function countItemTypesByUserID($userId, $itemType = false, $cond = '') { $this->dao->select('count(pk_i_id) as total'); $this->dao->from($this->getTableName()); $this->dao->where("fk_i_user_id = $userId"); //$this->dao->orderBy('pk_i_id', 'DESC'); if($itemType=='blocked') { $this->dao->where('b_enabled', 0); } elseif($itemType != 'all') { $this->dao->where('b_enabled', 1); } if($itemType == 'active') { $this->dao->where('b_active', 1); $this->dao->where("dt_expiration > '" . date('Y-m-d H:i:s') . "'"); } elseif($itemType == 'nospam') { $this->dao->where('b_spam', 0); $this->dao->where('b_active', 1); $this->dao->where("dt_expiration > '" . date('Y-m-d H:i:s') . "'"); } elseif($itemType == 'expired'){ $this->dao->where("dt_expiration <= '" . date('Y-m-d H:i:s') . "'"); } elseif($itemType == 'pending_validate'){ $this->dao->where('b_active', 0); } elseif($itemType == 'premium'){ $this->dao->where('b_premium', 1); } if ($cond != '') { $this->dao->where($cond); } $result = $this->dao->get(); if($result == false) { return 0; } $items = $result->row(); return $items['total']; } /** * Count items by Email according the type * Usefull for counting item that posted by unregistered user * * @access public * @since unknown * @param int $email Email * @param string $itemType (active, expired, pending validate, premium, all, enabled, blocked) * @return int number of items */ public function countItemTypesByEmail($email, $itemType = false, $cond = '') { $this->dao->select('count(pk_i_id) as total'); $this->dao->from($this->getTableName()); $this->dao->where("s_contact_email = '" . $email . "'"); if($itemType=='blocked') { $this->dao->where('b_enabled', 0); } elseif($itemType != 'all') { $this->dao->where('b_enabled', 1); } if($itemType == 'active') { $this->dao->where('b_active', 1); $this->dao->where("dt_expiration > '" . date('Y-m-d H:i:s') . "'"); } elseif($itemType == 'nospam') { $this->dao->where('b_spam', 0); $this->dao->where('b_active', 1); $this->dao->where("dt_expiration > '" . date('Y-m-d H:i:s') . "'"); } elseif($itemType == 'expired'){ $this->dao->where("dt_expiration <= '" . date('Y-m-d H:i:s') . "'"); } elseif($itemType == 'pending_validate'){ $this->dao->where('b_active', 0); } elseif($itemType == 'premium'){ $this->dao->where('b_premium', 1); } if ($cond != '') { $this->dao->where($cond); } $result = $this->dao->get(); if($result == false) { return 0; } $items = $result->row(); return $items['total']; } /** * Clear item stat given item id and stat to clear * $stat array('spam', 'duplicated', 'bad', 'offensive', 'expired', 'all') * * @access public * @since unknown * @param int $id * @param string $stat * @return mixed int if updated correctly or false when error occurs */ public function clearStat($id, $stat) { switch($stat) { case 'spam': $array_set = array('i_num_spam' => 0); break; case 'duplicated': $array_set = array('i_num_repeated' => 0); break; case 'bad': $array_set = array('i_num_bad_classified' => 0); break; case 'offensive': $array_set = array('i_num_offensive' => 0); break; case 'expired': $array_set = array('i_num_expired' => 0); break; case 'all': $array_set = array( 'i_num_spam' => 0, 'i_num_repeated' => 0, 'i_num_bad_classified' => 0, 'i_num_offensive' => 0, 'i_num_expired' => 0 ); default: break; } $array_conditions = array('fk_i_item_id' => $id); return $this->dao->update(DB_TABLE_PREFIX.'t_item_stats', $array_set, $array_conditions); } /** * Update title and description given a item id and locale. * * @access public * @since unknown * @param int $id * @param string $locale * @param string $title * @param string $text * @return bool */ public function updateLocaleForce($id, $locale, $title, $text) { $array_replace = array( 's_title' => $title, 's_description' => $text, 'fk_c_locale_code' => $locale, 'fk_i_item_id' => $id ); return $this->dao->replace(DB_TABLE_PREFIX.'t_item_description', $array_replace); } /** * Update dt_expiration field, using $expiration_time * * @param mixed $expiration_time could be interget (number of days) or directly a date * @return string new date expiration, false if error occurs */ public function updateExpirationDate($id, $expiration_time, $do_stats = true) { if($expiration_time=='') { return false; } $this->dao->select('dt_expiration'); $this->dao->from($this->getTableName()); $this->dao->where('pk_i_id', $id); $result = $this->dao->get(); if($result!==false) { $item = $result->row(); $expired_old = osc_isExpired($item['dt_expiration']); if(preg_match('|^([0-9]+)$|', $expiration_time, $match)) { if($expiration_time > 0) { $sql = sprintf("UPDATE %s SET dt_expiration = ", $this->getTableName()); $sql .= sprintf(' date_add(%s.dt_pub_date, INTERVAL %d DAY) ', $this->getTableName(), $expiration_time); $sql .= sprintf(' WHERE pk_i_id = %d', $id); } else { $sql = sprintf("UPDATE %s SET dt_expiration = '9999-12-31 23:59:59' WHERE pk_i_id = %d", $this->getTableName(), $id); } } else { $sql = sprintf("UPDATE %s SET dt_expiration = '%s' WHERE pk_i_id = %d", $this->getTableName(), $expiration_time, $id); } $result = $this->dao->query($sql); if($result && $result>0) { $this->dao->select('i.dt_expiration, i.fk_i_user_id, i.fk_i_category_id, l.fk_c_country_code, l.fk_i_region_id, l.fk_i_city_id'); $this->dao->from($this->getTableName()." i, ".DB_TABLE_PREFIX.'t_item_location l'); $this->dao->where('i.pk_i_id = l.fk_i_item_id' ); $this->dao->where('i.pk_i_id', $id ); $result = $this->dao->get(); $_item = $result->row(); if(!$do_stats) { return $_item['dt_expiration']; } $expired = osc_isExpired($_item['dt_expiration']); if($expired!=$expired_old) { if($expired) { if($_item['fk_i_user_id']!=null) { User::newInstance()->decreaseNumItems($_item['fk_i_user_id']); } CategoryStats::newInstance()->decreaseNumItems($_item['fk_i_category_id']); CountryStats::newInstance()->decreaseNumItems($_item['fk_c_country_code']); RegionStats::newInstance()->decreaseNumItems($_item['fk_i_region_id']); CityStats::newInstance()->decreaseNumItems($_item['fk_i_city_id']); } else { if($_item['fk_i_user_id']!=null) { User::newInstance()->increaseNumItems($_item['fk_i_user_id']); } CategoryStats::newInstance()->increaseNumItems($_item['fk_i_category_id']); CountryStats::newInstance()->increaseNumItems($_item['fk_c_country_code']); RegionStats::newInstance()->increaseNumItems($_item['fk_i_region_id']); CityStats::newInstance()->increaseNumItems($_item['fk_i_city_id']); } } return $_item['dt_expiration']; } } return false; } public function enableByCategory($enable, $aIds) { $sql = sprintf('UPDATE %st_item SET b_enabled = %d WHERE ', DB_TABLE_PREFIX, $enable ); $sql .= sprintf('%st_item.fk_i_category_id IN (%s)', DB_TABLE_PREFIX, implode(',', $aIds) ); return $this->dao->query($sql); } /** * Return the number of items marked as $type * * @param string $type spam, repeated, bad_classified, offensive, expired * @return int */ public function countByMarkas( $type ) { $this->dao->select('count(*) as total'); $this->dao->from($this->getTableName().' i'); $this->dao->from(DB_TABLE_PREFIX.'t_item_stats s'); $this->dao->where( 'i.pk_i_id = s.fk_i_item_id' ); // i_num_spam, i_num_repeated, i_num_bad_classified, i_num_offensive, i_num_expired if (!is_null($type)) { switch ($type) { case 'spam': $this->dao->where('s.i_num_spam > 0 AND i.b_spam = 0'); break; case 'repeated': $this->dao->where('s.i_num_repeated > 0'); break; case 'bad_classified': $this->dao->where('s.i_num_bad_classified > 0'); break; case 'offensive': $this->dao->where('s.i_num_offensive > 0'); break; case 'expired': $this->dao->where('s.i_num_expired > 0'); break; default: } } else { return 0; } $result = $this->dao->get(); if($result == false) { return 0; } $total_ads = $result->row(); return $total_ads['total']; } /** * Return meta fields for a given item * * @access public * @since unknown * @param int $id Item id * @return array meta fields array */ public function metaFields($id) { $this->dao->select('im.s_value as s_value,mf.pk_i_id as pk_i_id, mf.s_name as s_name, mf.e_type as e_type, im.s_multi as s_multi, mf.s_slug as s_slug '); $this->dao->from($this->getTableName().' i, '.DB_TABLE_PREFIX.'t_item_meta im, '.DB_TABLE_PREFIX.'t_meta_categories mc, '.DB_TABLE_PREFIX.'t_meta_fields mf'); $this->dao->where('mf.pk_i_id = im.fk_i_field_id'); $this->dao->where('mf.pk_i_id = mc.fk_i_field_id'); $this->dao->where('mc.fk_i_category_id = i.fk_i_category_id'); $array_where = array( 'im.fk_i_item_id' => $id, 'i.pk_i_id' => $id ); $this->dao->where($array_where); $result = $this->dao->get(); if($result == false) { return array(); } $aTemp = $result->result(); $array = array(); // prepare data - date interval - from <-> to foreach($aTemp as $value) { if($value['e_type'] == 'DATEINTERVAL') { $aValue = array(); if( isset($array[$value['pk_i_id']]) ) { $aValue = $array[$value['pk_i_id']]['s_value']; } $aValue[$value['s_multi']] = $value['s_value']; $value['s_value'] = $aValue; $array[$value['pk_i_id']] = $value; } else { $array[$value['pk_i_id']] = $value; } } return $array; } /** * Delete by primary key, delete dependencies too * * @access public * @since unknown * @param int $id Item id * @return bool */ public function deleteByPrimaryKey($id) { $item = $this->findByPrimaryKey($id); if ( is_null($item) ) { return false; } if( $item['b_active'] == 1 && $item['b_enabled']==1 && $item['b_spam']==0 && !osc_isExpired($item['dt_expiration'])) { if($item['fk_i_user_id']!=null) { User::newInstance()->decreaseNumItems($item['fk_i_user_id']); } CategoryStats::newInstance()->decreaseNumItems($item['fk_i_category_id']); CountryStats::newInstance()->decreaseNumItems($item['fk_c_country_code']); RegionStats::newInstance()->decreaseNumItems($item['fk_i_region_id']); CityStats::newInstance()->decreaseNumItems($item['fk_i_city_id']); } $this->deleteResourcesFromHD($id); $this->dao->delete(DB_TABLE_PREFIX.'t_item_description', "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_comment' , "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_resource', "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_location', "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_stats' , "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_meta' , "fk_i_item_id = $id"); osc_run_hook('delete_item', $id); $res = parent::deleteByPrimaryKey($id); return $res; } /** * Delete resources by primary key * * @access public * @since 3.1.1 * @param int $id item id * @return bool */ public function deleteResourcesFromHD( $id ) { $resources = ItemResource::newInstance()->getAllResourcesFromItem($id); Log::newInstance()->insertLog('Item', 'deleteResourcesFromHD', $id, $id, OC_ADMIN?'admin':'user', OC_ADMIN?osc_logged_admin_id():osc_logged_user_id()); $log_ids = ''; foreach($resources as $resource) { osc_deleteResource($resource['pk_i_id'], OC_ADMIN); $log_ids .= $resource['pk_i_id'].","; } Log::newInstance()->insertLog('Item', 'deleteResourcesFromHD', $id, substr($log_ids,0, 250), OC_ADMIN?'admin':'user', OC_ADMIN?osc_logged_admin_id():osc_logged_user_id()); } /** * Delete by city area * * @access public * @since 3.1 * @param int $cityAreaId city area id * @return bool */ public function deleteByCityArea($cityAreaId) { $this->dao->select('fk_i_item_id'); $this->dao->from(DB_TABLE_PREFIX.'t_item_location'); $this->dao->where('fk_i_city__area_id', $cityAreaId); $result = $this->dao->get(); $items = $result->result(); $arows = 0; foreach($items as $i) { $arows += $this->deleteByPrimaryKey($i['fk_i_item_id']); } return $arows; } /** * Delete by city * * @access public * @since unknown * @param int $cityId city id * @return bool */ public function deleteByCity($cityId) { $this->dao->select('fk_i_item_id'); $this->dao->from(DB_TABLE_PREFIX.'t_item_location'); $this->dao->where('fk_i_city_id', $cityId); $result = $this->dao->get(); $items = $result->result(); $arows = 0; foreach($items as $i) { $arows += $this->deleteByPrimaryKey($i['fk_i_item_id']); } return $arows; } /** * Delete by region * * @access public * @since unknown * @param int $regionId region id * @return bool */ public function deleteByRegion($regionId) { $this->dao->select('fk_i_item_id'); $this->dao->from(DB_TABLE_PREFIX.'t_item_location'); $this->dao->where('fk_i_region_id', $regionId); $result = $this->dao->get(); $items = $result->result(); $arows = 0; foreach($items as $i) { $arows += $this->deleteByPrimaryKey($i['fk_i_item_id']); } return $arows; } /** * Delete by country * * @access public * @since unknown * @param int $countryId country id * @return bool */ public function deleteByCountry($countryId) { $this->dao->select('fk_i_item_id'); $this->dao->from(DB_TABLE_PREFIX.'t_item_location'); $this->dao->where('fk_c_country_code', $countryId); $result = $this->dao->get(); $items = $result->result(); $arows = 0; foreach($items as $i) { $arows += $this->deleteByPrimaryKey($i['fk_i_item_id']); } return $arows; } /** * Extends the given array $item with description in available locales * * @access public * @since unknown * @param array $item * @return array item array with description in available locales */ public function extendDataSingle($item) { $prefLocale = osc_current_user_locale(); $this->dao->select(); $this->dao->from(DB_TABLE_PREFIX.'t_item_description'); $this->dao->where('fk_i_item_id', $item['pk_i_id']); $result = $this->dao->get(); $descriptions = $result->result(); $item['locale'] = array(); foreach ($descriptions as $desc) { if ($desc['s_title'] != "" || $desc['s_description'] != "") { $item['locale'][$desc['fk_c_locale_code']] = $desc; } } $is_itemLanguageAvailable = (!empty($item['locale'][$prefLocale]['s_title']) && !empty($item['locale'][$prefLocale]['s_description'])); if (isset($item['locale'][$prefLocale]) && $is_itemLanguageAvailable) { $item['s_title'] = $item['locale'][$prefLocale]['s_title']; $item['s_description'] = $item['locale'][$prefLocale]['s_description']; } else { $aCategory = Category::newInstance()->findByPrimaryKey($item['fk_i_category_id']); $title = sprintf(__('%s in'), $aCategory['s_name']); if(isset($item['s_city'])) { $title .= ' ' . $item['s_city']; } else if(isset($item['s_region'])) { $title .= ' ' .$item['s_region']; } else if(isset($item['s_country'])) { $title .= ' ' . $item['s_country']; } $item['s_title'] = $title; $item['s_description'] = __('There\'s no description available in your language'); unset($data); } return $item; } /** * Extends the given array $items with category name , and description in available locales * * @access public * @since unknown * @param array $items array with items * @return array with category name */ public function extendCategoryName($items) { if( OC_ADMIN ) { $prefLocale = osc_current_admin_locale(); } else { $prefLocale = osc_current_user_locale(); } $results = array(); foreach ($items as $item) { $this->dao->select('fk_c_locale_code, s_name as s_category_name'); $this->dao->from(DB_TABLE_PREFIX.'t_category_description'); $this->dao->where('fk_i_category_id', $item['fk_i_category_id']); $result = $this->dao->get(); $descriptions = $result->result(); foreach ($descriptions as $desc) { $item['locale'][$desc['fk_c_locale_code']]['s_category_name'] = $desc['s_category_name']; } if (isset($item['locale'][$prefLocale]['s_category_name'])) { $item['s_category_name'] = $item['locale'][$prefLocale]['s_category_name']; } else { $data = current($item['locale']); if( isset($data['s_category_name']) ) { $item['s_category_name'] = $data['s_category_name']; } else { $item['s_category_name'] = ''; } unset($data); } $results[] = $item; } return $results; } /** * Extends the given array $items with description in available locales * * @access public * @since unknown * @param type $items * @return array with description extended with all available locales */ public function extendData($items) { if( OC_ADMIN ) { $prefLocale = osc_current_admin_locale(); } else { $prefLocale = osc_current_user_locale(); } $results = array(); foreach ($items as $item) { $this->dao->select(); $this->dao->from(DB_TABLE_PREFIX.'t_item_description'); $this->dao->where(DB_TABLE_PREFIX.'t_item_description.fk_i_item_id', $item['pk_i_id']); $result = $this->dao->get(); $descriptions = $result->result(); $item['locale'] = array(); foreach ($descriptions as $desc) { if ($desc['s_title'] != "" || $desc['s_description'] != "") { $item['locale'][$desc['fk_c_locale_code']] = $desc; } } if (isset($item['locale'][$prefLocale])) { $item['s_title'] = $item['locale'][$prefLocale]['s_title']; $item['s_description'] = $item['locale'][$prefLocale]['s_description']; } else { $data = current($item['locale']); $item['s_title'] = $data['s_title']; $item['s_description'] = $data['s_description']; unset($data); } // populate locations and category_name $this->dao->select(DB_TABLE_PREFIX.'t_item_location.*, cd.s_name as s_category_name'); // select sum item_stats $this->dao->select('SUM(`s`.`i_num_views`) as `i_num_views`' ); $this->dao->select('SUM(`s`.`i_num_spam`) as `i_num_spam`' ); $this->dao->select('SUM(`s`.`i_num_bad_classified`) as `i_num_bad_classified`' ); $this->dao->select('SUM(`s`.`i_num_repeated`) as `i_num_repeated`' ); $this->dao->select('SUM(`s`.`i_num_offensive`) as `i_num_offensive`' ); $this->dao->select('SUM(`s`.`i_num_expired`) as `i_num_expired` ' ); $this->dao->select('SUM(`s`.`i_num_premium_views`) as `i_num_premium_views` ' ); $this->dao->from(DB_TABLE_PREFIX.'t_item_location'); $this->dao->from(DB_TABLE_PREFIX.'t_category_description as cd'); $this->dao->from(DB_TABLE_PREFIX.'t_item_stats as s'); $this->dao->where(DB_TABLE_PREFIX.'t_item_location.fk_i_item_id', $item['pk_i_id']); // $this->dao->where(DB_TABLE_PREFIX.'t_item_stats.fk_i_item_id', $item['pk_i_id']); $this->dao->where('s.fk_i_item_id', $item['pk_i_id']); $this->dao->where('cd.fk_i_category_id', $item['fk_i_category_id']); // group by item_id $this->dao->groupBy('fk_i_item_id'); $result = $this->dao->get(); $extraFields = $result->row(); foreach($extraFields as $key => $value) { $item[$key] = $value; } $results[] = $item; } return $results; } } /* file end: ./oc-includes/osclass/model/Item.php */ ?>
© 2017 -
ZeroByte.ID
.